package com.action.sale;

import java.io.IOException;
import java.util.List;

import javax.servlet.ServletException;
import javax.servlet.http.HttpServlet;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;

import com.dao.SaleOrderDAO;
import com.dao.impl.SaleOrderDAOImpl;

public class enterProductServlet extends HttpServlet {
	private static final long serialVersionUID = 1L;

	protected void doGet(HttpServletRequest request,
			HttpServletResponse response) throws ServletException, IOException {
		// TODO Auto-generated method stub
		request.setCharacterEncoding("utf-8");
		response.setCharacterEncoding("utf-8");
		response.setContentType("text/html;charset=utf-8");

		String customerNo = request.getParameter("customerNo");
		String productNo = request.getParameter("productNo");
		int quantity = Integer.parseInt(request.getParameter("quantity"));
		double discount = Double.parseDouble(request.getParameter("discount"));

		SaleOrderDAO aod = new SaleOrderDAOImpl();
		List itemTempList = aod.enterProduct(customerNo, productNo, quantity,
				discount);
		request.getSession().setAttribute("ItemTempList", itemTempList);

	}

	protected void doPost(HttpServletRequest request,
			HttpServletResponse response) throws ServletException, IOException {
		// TODO Auto-generated method stub
		doGet(request, response);
	}

}
